package com.visualexpress.predict;

import java.util.List;

import com.visualexpress.dao.LocationAvertimeDAO;
import com.visualexpress.domain.LocationAvertime;

public class GetCityEfficiency {
	public static EfficiencyLevel getCityEfficiency(double timeForThisCity) {
		
		if( timeForThisCity<0) {
			return EfficiencyLevel.ERROR;
		}
		
		LocationAvertimeDAO locAverTimeDAO = new LocationAvertimeDAO();
		double avgTimeStay = locAverTimeDAO.getAvgTimeStay();
		
		
		if(timeForThisCity > avgTimeStay * 1.2) {
			// low efficiency
			return EfficiencyLevel.LOW;
		} else if(timeForThisCity < avgTimeStay * 0.8) {
			// high efficiency
			return EfficiencyLevel.HIGH;
		} else {
			// medium efficiency
			return EfficiencyLevel.MEDIUM;
		}
	}
}
